﻿
@{
    Layout = null;

}
<link rel="stylesheet" href="~/css/table.css" type="text/css">
<script src="~/jquery-easyui-1.3.5/jquery-1.11.1.js"></script>
<script src="~/Js/jquery.validate.js"></script>
<script src="~/Js/jquery.validate.unobtrusive.js"></script>
<script src="~/Js/jquery.unobtrusive-ajax.js"></script>
<script src="~/js/vue.js"></script>
<style type="text/css">
    body {
        background: #FFD553;
    }
</style>
@using Model
@model salary_standard
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="../../css/table.css" type="text/css" />
        <script type="text/javascript" src="../../javascript/comm/comm.js"></script>
        <script type="text/javascript" src="../../javascript/jquery-1.7.2.js"></script>
        <title>无标题文档</title>
    </head>
<div id="app">
    <form method="post" asp-action="Add">
        <table width="100%">
            <tr>
                <td>
                    <font color="black">
                        您正在做的业务是：人力资源--薪酬标准管理--薪酬标准登记
                    </font>
                </td>
            </tr>
            <tr>
                <td align="right">
                    <input type="submit" value="提 交" class="BUTTON_STYLE1">
                    <input type="reset" value="返 回" class="BUTTON_STYLE1">
                </td>
            </tr>
        </table>
        <input type="hidden"  asp-for="check_status" value="1" class="INPUT_STYLE2">
        <table id="stable" width="100%" border="1" cellpadding=0 cellspacing=1
               bordercolorlight=#848284 bordercolordark=#eeeeee
               class="TABLE_STYLE1">
            <tr>
                <td width="74" class="TD_STYLE1">
                    薪酬标准编号
                </td>
                <td width="168" class="TD_STYLE2">
                    <input type="text" asp-for="standard_id" readonly="readonly" class="INPUT_STYLE2">
                </td>
                <td width="83" class="TD_STYLE1">
                    薪酬标准名称
                </td>
                <td width="171" class="TD_STYLE2">
                    <input type="text" asp-for="standard_name" id="standardName" class="INPUT_STYLE2" placeholder="请输入薪酬标准名称">
                    <span asp-validation-for="standard_name"></span>
                </td>
                <td width="170" class="TD_STYLE1">
                    薪酬总额
                </td>
                <td width="138" class="TD_STYLE2">
                    <input type="text" asp-for="salary_sum" id="salary_sum" readonly class="INPUT_STYLE2" />
                </td>
                <td width="103" class="TD_STYLE1">
                    &nbsp;
                </td>
                <td width="95" height="26" class="TD_STYLE2">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="TD_STYLE1">
                    制定人
                </td>
                <td class="TD_STYLE2">
                    @*<input type="text" id="designer" asp-for="_designer" class="INPUT_STYLE2" placeholder="请输入制定人">*@
                    @Html.DropDownListFor(e => e.designer, ViewBag.s as IEnumerable<SelectListItem>, new { @class = "INPUT_STYLE2" })
                    <span asp-validation-for="designer"></span>
                </td>
                <td class="TD_STYLE1">
                    登记人
                </td>
                <td class="TD_STYLE2">
                    <input type="text" asp-for="register" readonly="readonly" class="INPUT_STYLE2">
                    <span asp-validation-for="register"></span>
                </td>
                <td class="TD_STYLE1">
                    登记时间
                </td>
                <td class="TD_STYLE2">
                    <input type="text" id="Tdate" asp-for="regist_time" readonly="readonly" class="INPUT_STYLE2">
                </td>
                <td class="TD_STYLE1">
                    &nbsp;
                </td>
                <td class="TD_STYLE2">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="TD_STYLE1">
                    备注
                </td>
                <td colspan="7" class="TD_STYLE2">
                    <textarea asp-for="remark" rows="4" class="TEXTAREA_STYLE1"></textarea>
                </td>
            </tr>
            <tr class="TD_STYLE1" id="td3">
                <td align="center">
                    序号
                </td>
                <td colspan="3">
                    薪酬项目名称
                </td>
                <td>
                    金额
                </td>
                <td colspan="3">
                    &nbsp;
                </td>

            </tr>
            <tbody id="td1">
                <tr id="td2">
                    <td v-for="(item,index) in dt">
                        <input id="Checkbox1" type="checkbox" :value="[item.attribute_name]" />{{item.attribute_name}}
                        <input id="pbcid" name="pbcid" type="hidden" :value="[item.Id]" />
                    </td>
                    <td><input type="button" value="选择薪酬组成" v-on:click="CheckAdd" /></td>
                </tr>
            </tbody>
        </table>
    </form>
</div>

<script type="text/javascript">
    function time() {
        var tdate = document.getElementById("Tdate");
        var d = new Date();
        var y = d.getFullYear();
        var moth = d.getMonth() + 1;
        var date = d.getDate();
        var h = d.getHours();
        var m = d.getMinutes();
        var s = d.getSeconds();
        var hh = 20 - 1 - h;
        var mm = 60 - 1 - m;
        var ss = 60 - s;
        if (hh > 0) {
            mm = mm + 60 * hh;
        }
        if (moth < 10) {
            moth = "0" + moth;
        }
        if (date < 10) {
            date = "0" + date;
        }
        if (h < 10) {
            h = "0" + h;
        }
        if (m < 10) {
            m = "0" + m;
        }
        if (s < 10) {
            s = "0" + s;
        }
        if (mm < 10) {
            mm = "0" + mm;
        }
        if (ss < 10) {
            ss = "0" + ss;
        }

        tdate.value = y + "-" + moth + "-" + date + " " + h + ":" + m + ":" + s;

    }
    window.onload = time;
    var out = window.setInterval(time, 1000);
    $(document).on("keyup", "input[id='salary']", function () {
        var t = this;
        var shu = $(this).val();
        if (isNaN(shu) || shu < 0) {
            alert("金额填写错误!");
            t.val("0.00");
        }
        var sum = 0;
        var zz = $('input[id=salary]').length;
        for (var i = 0; i < zz; i++) {
            var salary = $("input[id='salary']").eq(i).val();
            if (salary == "") {
                salary = "0.00";
            }
            sum = Number(sum) + Number(salary);
        }
        document.getElementById("salary_sum").value = sum;
    })
    var vm = new Vue({
        el: "#app",
        data: {
            dt: []
        },
        methods: {
            CheckAdd: function () {
                var zhi = $('input[type=checkbox]:checked').length;
                for (var i = 0; i < zhi; i++) {
                    var zz = $('input[type=checkbox]:checked').eq(i).val();
                    var ss = $('input[type=checkbox]:checked').eq(i).next().val();
                    var $tr = $("<tr class='TD_STYLE2'></tr>");
                    var $td1 = "<td><input type='hidden' value='" + ss + "' name='item_id' />" + ss + "</td><td colspan='3'><input type='hidden' value='" + zz + "' name='item_name' />" + zz + "</td><td><input type='text' id='salary' value='0.00' name='salary' class='INPUT_STYLE2'></td><td colspan='3'>&nbsp;</td>";
                    $tr.append($td1);
                    $("#td1").append($tr);
                }
                $("#td3").show();
                $("#td2").remove();
            },
            fill: function () {
                var t = this;
                $("#td3").hide();
                $.ajax({
                    url: "/salaryCriterion/Index2",
                    type: "get",
                    success: function (msg) {
                        var d = eval("(" + msg + ")");
                        t.dt = d;
                    }
                });
            },

        },
        mounted: function () {
            this.fill();
        }
    });

</script>


